<div class="col" style="align-items:baseline;">
  <h2><%= translation('features.features_title')%></h2>
  <p><%= translation('features.description') %></p>
  <% if current_user.admin? %>
    <p><a class="btn btn-outline-secondary" href="/features/new"><%= translation('features.add_feature') %></a></p>
  <% end %>
</div>
<table class="table">
  <tr>
    <th><a href = "?sort=title"><%= translation('features.title') %></a> <i class="fa fa-sort" aria-hidden="true"></i></th>
    <% if current_user.admin? %>
    <th><%= translation('features.edit') %></th>
    <% end %>
    <th><a href = "?sort=last_edited"><%= translation('features.last_edition') %></a> <i class="fa fa-sort" aria-hidden="true"></i></th>
  </tr>
  <% @sorted_features.each do |feature| %>
    <tr>
      <td style="width:50%"><a href="/features/<%= feature.id %>"><%= feature.title %></a></td>
      <% if current_user.admin? %>
      <td><a href="/features/<%= feature.id %>/edit?t=<%= Time.now.to_i %>">edit</a></td>
      <% end %>
      <td><%= time_ago_in_words(feature.latest.created_at) %> <%= translation('features.ago_by') %>
      <a href="/profile/<%= feature.latest.author.name %>"><%= feature.latest.author.name %></td>
    </tr>
  <% end %>
</table>

<%= will_paginate @sorted_features, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
